#include "Windmill.h"

Slide* Windmill::windmill = NULL;

Windmill::Windmill(Point<float> pos) : MovingSprite() {
	loadBitmap();

	ani->go();
	ani->setSlide(windmill, .13);

	this->start(pos);
}

void Windmill::loadBitmap() {
	if(windmill != NULL)
		return;

	windmill = new Slide();

	windmill->image = al_load_bitmap("rsc/Objects/Windmill/aWindmill.tga");
	windmill->slideWidth = 160;
	windmill->slideHeight = 256;
	windmill->numSlides = 12;
}

void Windmill::update() {
}

void Windmill::draw(Point<float> camPos) {
	al_draw_bitmap(ani->getImage(), pos.x - camPos.x, pos.y - camPos.y, 0);
}

void Windmill::deleteImages() {
	if(windmill == NULL)
		return;

	al_destroy_bitmap(windmill->image);
	delete windmill;
	windmill = NULL;
}